package com.orphan.audit.GainMq;
import com.orphan.audit.dao.PromotionCommodityMapper;
import com.orphan.audit.dao.UserreturnCommodityMapper;
import com.orphan.audit.po.PromotionCommodity;
import com.orphan.audit.po.UserreturnCommodity;
import com.orphan.util.dto.OrderReturnDto;
import com.orphan.util.dto.PromotionGoodsDto;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MqAudit {
    @Autowired
    UserreturnCommodityMapper userreturnCommodityMapper;
//    @Autowired
//    PromotionCommodityMapper promotionCommodityMapper;
//    @RabbitListener(queues = "queueaudit")
//    public void getInformation(SupplierReturnDto supplierReturnDto){
//        System.out.println(supplierReturnDto);
//    }

//    @RabbitListener(queues = "queueOrderReturn")
//    public void getOrderReturnMQ(OrderReturn orderReturn){
//        System.out.println("orderReturn  = " + orderReturn);
//        OrderReturn orderReturn = new OrderReturn();
//
//        orderReturn.setOrderNo(returnsDetailsDto.getOrderNo());
//        orderReturn.setReturnsNo(returnsDetailsDto.getReturnsNo());
//        orderReturn.setGoodsName(returnsDetailsDto.getGoodsName());
//        orderReturn.setGoodsCount(returnsDetailsDto.getGoodsCount());
//        orderReturn.setGoodsOrderStatus(returnsDetailsDto.getGoodsOrderStatus());
//        orderReturn.setGoodsPrice(returnsDetailsDto.getGoodsPrice());
//        orderReturn.setReturnsTime(returnsDetailsDto.getReturnsTime());
//        orderReturn.setGoodsType(returnsDetailsDto.getGoodsType());
//
//        int insert = returnOrderMapper.insert(orderReturn);
//        if(insert > 0){
//            rabbitTemplate.convertAndSend("queueOrderReturn","orderReturn",orderReturn);
//        }

//
//    @RabbitListener(queues = "queueOrderReturn")
//    public void getInformation2(OrderReturnDto userReturnGoodsDto){
//        UserreturnCommodity userreturnCommodity = new UserreturnCommodity();
//        userreturnCommodity.setGoodsCount(userReturnGoodsDto.getGoodsCount());
//        userreturnCommodity.setGoodsName(userReturnGoodsDto.getGoodsName());
//        userreturnCommodity.setGoodsOrderStatus(2);
//        userreturnCommodity.setReturnsTime(userReturnGoodsDto.getReturnsTime());
//        userreturnCommodity.setOrderNo(userReturnGoodsDto.getOrderNo());
//        userreturnCommodity.setReturnsNo(userReturnGoodsDto.getReturnsNo());
//        userreturnCommodity.setGoodsType(userReturnGoodsDto.getGoodsType());
//        userreturnCommodity.setGoodsPrice(userReturnGoodsDto.getGoodsPrice());
//        userreturnCommodityMapper.insert(userreturnCommodity);
//        System.out.println(userReturnGoodsDto);
//    }




//    @RabbitListener(queues = "queueProm")
//    public void getInformation3(PromotionGoodsDto promotionGoodsDto) {
//        System.out.println(promotionGoodsDto);
//        PromotionCommodity promotionCommodity = new PromotionCommodity();
//        promotionCommodity.setId(promotionGoodsDto.getGoodsId());
//        promotionCommodity.setGoodsNum(promotionGoodsDto.getGoodsNum());
//        promotionCommodity.setGoodsName(promotionGoodsDto.getGoodsName());
//        promotionCommodity.setGoodsType(promotionGoodsDto.getGoodsType());
//        promotionCommodity.setGoodsPrice(promotionGoodsDto.getGoodsPrice());
//        promotionCommodity.setGoodsDiscount(promotionGoodsDto.getGoodsDiscount());
//        promotionCommodityMapper.insert(promotionCommodity);
//          promotionGoodsDto.setGoodsTag(2);
//        System.out.println("promotionCommodity = " + promotionCommodity);
//    }
}
